import request from '@/utils/request'

export function captcha(str) {
  return request({
    url: `/invest/captcha.jpg?uuid=${str}`,
    method: 'get'
  })
}

export function login(data) {
  return request({
    url: '/invest/sys/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/invest/sys/logout',
    method: 'post'
  })
}

// 用户列表和搜索
export function userList(data) {
  return request({
    url: '/invest/sys/user/userList',
    method: 'post',
    data
  })
}

// 修改密码
export function updatePassword(data) {
  return request({
    url: '/invest/sys/user/password',
    method: 'post',
    data
  })
}

// 添加用户
export function addUser(data) {
  return request({
    url: '/invest/sys/user/save',
    method: 'post',
    data
  })
}

// 修改用户
export function updateUser(data) {
  return request({
    url: '/invest/sys/user/update',
    method: 'post',
    data
  })
}

// 删除用户
export function deleteUser(data) {
  return request({
    url: '/invest/sys/user/delete',
    method: 'post',
    data,
    'Content-Type': 'multipart/form-data'
  })
}



